package shoot;

import java.awt.image.BufferedImage;

/**
 * 小敌机类
 * @author pc
 *
 */
public class AirPlane extends FlyingObject  implements Enemy{

	private int speed;
	private static BufferedImage[] images=new BufferedImage[4];
	static {
		for (int i = 0; i < images.length; i++) {
			images[i]=loadImage("smallairplane"+i+".png");
		}
	}
	
	/**
	 * 构造方法 初始化
	 * @param x
	 * @param y
	 */
	public AirPlane() {
		super(49, 26);
		this.speed=2;
	}
	
	int index=0;
	@Override
	public BufferedImage getImage() {
		// TODO Auto-generated method stub
		if (isLift()) {
			return images[0];
		}else if (isRemove()) {
			if (index==images.length) {
				status=DIE;
			}
			return images[index++];
		}
		return null;
	}
	
	@Override
	public void step() {
		// TODO Auto-generated method stub
		this.y+=speed;
		
	}
	
	@Override
	public int getScore() {
		// TODO Auto-generated method stub
		return 1;
	}
	
}
